package com.jxdinfo.hussar.example.mes.assess.controller;

import com.jxdinfo.hussar.example.common.core.controller.BaseController;
import com.jxdinfo.hussar.example.common.core.domain.AjaxResult;
import com.jxdinfo.hussar.example.common.core.page.TableDataInfo;
import com.jxdinfo.hussar.example.common.utils.poi.ExcelUtil;
import com.jxdinfo.hussar.example.mes.assess.domain.MesAssessOutputRecord;
import com.jxdinfo.hussar.example.mes.assess.service.IMesAssessOutputRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 车间产量记录Controller
 *
 * @author ruoyi
 * @date 2024-04-16
 */
@RestController
@RequestMapping("/assess/assessoutputrecord")
public class MesAssessOutputRecordController extends BaseController
{
    @Autowired
    private IMesAssessOutputRecordService mesAssessOutputRecordService;

    /**
     * 查询车间产量记录列表
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(MesAssessOutputRecord mesAssessOutputRecord)
    {
        startPage();
        List<MesAssessOutputRecord> list = mesAssessOutputRecordService.selectMesAssessOutputRecordList(mesAssessOutputRecord);
        return getDataTable(list);
    }

    /**
     * 导出车间产量记录列表
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:export')")
//    @Log(title = "车间产量记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MesAssessOutputRecord mesAssessOutputRecord)
    {
        List<MesAssessOutputRecord> list = mesAssessOutputRecordService.selectMesAssessOutputRecordList(mesAssessOutputRecord);
        ExcelUtil<MesAssessOutputRecord> util = new ExcelUtil<MesAssessOutputRecord>(MesAssessOutputRecord.class);
        util.exportExcel(response, list, "车间产量记录数据");
    }

    /**
     * 获取车间产量记录详细信息
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:query')")
    @GetMapping(value = "/get/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(mesAssessOutputRecordService.selectMesAssessOutputRecordById(id));
    }

    /**
     * 新增车间产量记录
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:add')")
//    @Log(title = "车间产量记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody MesAssessOutputRecord mesAssessOutputRecord)
    {
        return toAjax(mesAssessOutputRecordService.insertMesAssessOutputRecord(mesAssessOutputRecord));
    }

    /**
     * 修改车间产量记录
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:edit')")
//    @Log(title = "车间产量记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody MesAssessOutputRecord mesAssessOutputRecord)
    {
        return toAjax(mesAssessOutputRecordService.updateMesAssessOutputRecord(mesAssessOutputRecord));
    }

    /**
     * 删除车间产量记录
     */
//    @PreAuthorize("@ss.hasPermi('assess:assessoutputrecord:remove')")
//    @Log(title = "车间产量记录", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mesAssessOutputRecordService.deleteMesAssessOutputRecordByIds(ids));
    }
}
